﻿using PLCS.Domain.Shared.Tasks;

namespace PLCS.Domain.Tasks;

/// <summary>
/// 历史指令表
/// </summary>
public class HisInstruction : BaseEntity
{
    /// <summary>
    /// 指令号
    /// </summary>
    public int InstructionNo { get; set; }

    /// <summary>
    /// 执行设备编号
    /// </summary>
    public string EquipmentNo { get; set; }

    /// <summary>
    /// 指令类型
    /// </summary>
    public InstructionType InstructionType { get; set; }

    /// <summary>
    /// 起始位
    /// </summary>
    public string? StartPos { get; set; }

    /// <summary>
    /// 目标位
    /// </summary>
    public string? EndPos { get; set; }

    /// <summary>
    /// 托盘类型
    /// </summary>
    public TrayType TrayType { get; set; }

    /// <summary>
    /// 指令状态
    /// </summary>
    public Shared.Tasks.InstructionStatus Status { get; set; }

    /// <summary>
    /// 坐标行走用
    /// </summary>
    public int MovePos { get; set; }

    private HisInstruction()
    {
    }

    public HisInstruction(int instructionNo, string equipmentNo, InstructionType instructionType, string? startPos = null, string? endPos = null, TrayType trayType = default, int movePos = 0)
    {
        InstructionNo = instructionNo;
        EquipmentNo = equipmentNo;
        InstructionType = instructionType;
        StartPos = startPos;
        EndPos = endPos;
        Status = Shared.Tasks.InstructionStatus.已完成;
        TrayType = trayType;
        MovePos = movePos;
    }
}